package com.attms.domain;

import java.time.LocalDate;

public class AbsentSetter {
    public void visit(Employee employee){
        int gender = employee.getE_GENDER();
        int workTime = employee.getE_START().until(LocalDate.now()).getDays();
        int age = employee.getE_BIRTH().until(LocalDate.now()).getYears();
        int job = employee.getE_JOB() + 1;
        if (workTime < 1) {
            employee.setE_RYEAR(1 * job);
        } else if (workTime < 10) {
            employee.setE_RYEAR(5 * job);
        } else if (workTime < 20) {
            employee.setE_RYEAR(10 * job);
        } else {
            employee.setE_RYEAR(15 * job);
        }
        // 病假5天
        employee.setE_RILL(5 * job);
        // 婚假
        if ((gender == 0 && age <= 23) || (gender == 1 && age <= 25)) {
            employee.setE_RWEDDING(3 * job);
        } else {
            employee.setE_RWEDDING(10 * job);
        }
        // 产假、陪产假
        if (gender == 0) {
            employee.setE_RPATERNITY(0 * job);
            employee.setE_RMATERNITY(98 * job);
            employee.setE_RLACTATION(60 * job);// 60min
        } else {
            employee.setE_RPATERNITY(7 * job);
            employee.setE_RMATERNITY(0 * job);
            employee.setE_RLACTATION(0 * job);// 60min
        }
    }
}
